package Card.dao.impl;

import Admin.entity.Admin;
import Card.dao.BaseDao;
import Card.dao.CardDao;
import Card.entity.Card;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

/**
 * @author chenle
 * @version 1.0
 * @date 2023/10/7 16:49
 */
public class CardDaoImpl extends BaseDao implements CardDao {
    @Override
    public List<Card> getlist() {
        String sql="SELECT * FROM Card";
        ResultSet rs=this.executeQuery(sql);
        List<Card>list=new ArrayList<>();
        try {
           while (rs.next()){
               list.add(new Card(rs.getInt(1),rs.getString(2),rs.getFloat(3),rs.getString(4),rs.getString(5),rs.getString(6)));
           }
        } catch (SQLException throwables) {
            throwables.printStackTrace();
        }finally {
            this.closeConnection(null,null,rs);
        }
        return list;
    }
}
